package com.kiki.recommendations.mapper;

import java.util.List;
import com.kiki.recommendations.domain.Recommendations;
import com.kiki.song.domain.main.Song;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

/**
 * 推荐结果Mapper接口
 * 
 * @author 林志毅
 * @date 2025-04-25
 */
public interface RecommendationsMapper 
{
    /**
     * 查询推荐结果
     * 
     * @param recId 推荐结果主键
     * @return 推荐结果
     */
    public Recommendations selectRecommendationsByRecId(Long recId);

    /**
     * 查询推荐结果列表
     * 
     * @param recommendations 推荐结果
     * @return 推荐结果集合
     */
    public List<Recommendations> selectRecommendationsList(Recommendations recommendations);

    /**
     * 新增推荐结果
     * 
     * @param recommendations 推荐结果
     * @return 结果
     */
    public int insertRecommendations(Recommendations recommendations);

    /**
     * 修改推荐结果
     * 
     * @param recommendations 推荐结果
     * @return 结果
     */
    public int updateRecommendations(Recommendations recommendations);

    /**
     * 删除推荐结果
     * 
     * @param recId 推荐结果主键
     * @return 结果
     */
    public int deleteRecommendationsByRecId(Long recId);

    /**
     * 批量删除推荐结果
     * 
     * @param recIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteRecommendationsByRecIds(Long[] recIds);

    @Delete("delete from recommendations where type='OffLine'")
    void cleanOldData();

    @Delete("delete from recommendations where user_id=#{userId} AND type='OnLine'")
    void deleteRecommendationsByUserId(String userId);

    @Select("select song_id from recommendations where user_id=#{userId} AND type='OffLine'")
    List<Long> getSongIdByUserId(int userId);


    @Select("select song_id from recommendations where user_id=#{userId} AND type='OnLine'")
    List<Long> getSongIdByUserId2(int userId);


}
